﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Web;
using System.Web.Http.Filters;

using Aspose.Cells;
using Oracle.ManagedDataAccess.Client;
using System.Data;
namespace XBJCYGC
{
    public static class UTIL
    {
        #region getip
        private const string HttpContext = "MS_HttpContext";
        private const string RemoteEndpointMessage =
            "System.ServiceModel.Channels.RemoteEndpointMessageProperty";
        private const string OwinContext = "MS_OwinContext";

        public static string GetClientIp(HttpRequestMessage request)
        {
            // Web-hosting
            if (request.Properties.ContainsKey(HttpContext))
            {
                HttpContextWrapper ctx =
                    (HttpContextWrapper)request.Properties[HttpContext];
                if (ctx != null)
                {
                    return ctx.Request.UserHostAddress;
                }
            }
            return null;
        }
        #endregion
    }

    /// <summary>
    /// 采油工程的全局异常过滤器。传入一个字符串信息
    /// </summary>
    public class CYGCExceptionFilterAttribute : ExceptionFilterAttribute
    {
        public string Msg { get; set; }

        public CYGCExceptionFilterAttribute(string msg)
        {
            Msg = msg;
        }

        public override void OnException(HttpActionExecutedContext context)
        {
            context.Response = new HttpResponseMessage(HttpStatusCode.NotImplemented)
            {
                Content = new StringContent(Msg + "\n" + context.Exception.Message)
            };
        }
    }

    /// <summary>
    /// 导出excel
    /// </summary>
    //public static class ExportXls
    //{
    //    static string GetHZ(int number)
    //    {
    //        if (number==0)
    //        {
    //            return "";
    //        }
    //        string strHZ = "零一二三四五六七八九";
    //        string r = "";
    //        number.ToString().ForEach<char>(n => r += (strHZ[int.Parse(n.ToString())]));
    //        return r;
    //    }
    //    static string GetHZ(string number)
    //    {
    //        int num = int.Parse(number);
    //        //如果是日期或月份，则要考虑》10的情况
    //        if (num >= 10 && num<20)
    //        {
    //            return "十" + GetHZ(num - 10);
    //        }
    //        else if (num >= 20 && num < 30)
    //        {
    //            return "二十" + GetHZ(num - 20);
    //        }
    //        else if (num >= 30 && num < 32)
    //        {
    //            return "三十" + GetHZ(num - 20);
    //        }
    //        //如果是年2015，或是1位数字则原样返回！
    //        return GetHZ(num);

    //    }
    //    /// <summary>
    //    /// 局厂两级的统一的导出excel的过程，通过exportflag判断导出的数据级别。通过bbhs判断需要导出的报表，如果为*，则导出全部报表
    //    /// </summary>
    //    /// <param name="ny"></param>
    //    /// <param name="dwdm"></param>
    //    /// <param name="mbpath"></param>
    //    /// <param name="filename"></param>
    //    /// <param name="exportflag"></param>
    //    /// <param name="bbhs"></param>
    //    /// <returns></returns>
    //    public static HttpResponseMessage doExport(string ny, string dwdm,string username, string mbpath, string filename, string exportflag, string bbhs)
    //    {
    //        #region 配置信息
    //        GCBBINFO[] vw_list = new GCBBINFO[] {
    //            new GCBBINFO{Bbh="b01",ViewName="vw_b01",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "YQSZJS", "YQSKJS", "YQSKJL", "YQSGJS", "YJZJS", "ZPJZJS", "PTGGZJS", "GQDGZJS", "FGSQTGZJS",
    //                             "CYJZJS", "DQBZJS", "QJZJS", "FGSQTBZJS", "YJKJS", "YJKJL", "ZPJKJS", "PTGGKJS", "GQDGKJS", "FGSQTGKJS",
    //                             "CYJKJS", "DQBKJS", "QJKJS", "FGSQTBKJS", "YJGJS"},
    //                header2Fields=new string[]{"DWMC", "SJZJS", "SJKJS", "SJKJL", "SJGJS", "GYHJ", "GYKJ", "GYGJ", "CYHJ", "CYKJ", "CYGJ", "FCHJ", "FCKJ", "FCGJ",
    //                            "LTHJ", "LTKJ", "LTGJ", "KJS16", "KJS25", "KJS32", "KJS32MORE", "CQJZJS", "CQJKJS", "CQJKJL", "CQJGJS"}},
    //            new GCBBINFO{Bbh="b021",ViewName="vw_b021",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18, IsMergable=false,
    //                headerFields=new string[] {"DWMC", "ZJS", "XZHJ", "XZXT", "XZCZ", "XZGC", "GJS", "JHGJS", "TCJHJ", "TCJHJRC", "TCJDYDC",
    //                            "TCJDYDCRC", "TCJGHS", "TCJGHSRC", "TCJGYQB", "TCJGYQBRC", "TCJSD", "TCJSDRC", "TCJLD", "TCJLDRC", "TCJJXGZ",
    //                            "TCJJXGZRC", "TCJDMYY", "TCJDMYYRC", "TCJQT", "TCJQTRC", "DBFJS", "YJYLYL", "YJNLYL",
    //                            "YJYTJL", "YJNTJL", "YCYSL", "NCYSL"}},
    //            new GCBBINFO{Bbh="b022",ViewName="vw_b022",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18, IsMergable=false,
    //                headerFields=new string[] {"DWMC", "ZJS", "XZHJ", "XZXT", "XZCZ", "XZGC", "GJS", "JHGJS", "TCJHJ", "TCJHJRC", "TCJDYDC", "TCJDYDCRC", "TCJSY",
    //                            "TCJSYRC", "TCJDMYY", "TCJDMYYRC", "TCJDS", "TCJDSRC", "TCJJXGZ", "TCJJXGZRC", "TCJQT", "TCJQTRC", "DBFJS", "QJYLYL", "QJNLYL",
    //                             "QJYTJL", "QJNTJL", "YSCSX", "NSCSX"}},
    //            new GCBBINFO{Bbh="b023",ViewName="vw_b023",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18, IsMergable=false,
    //                headerFields=new string[] {"DWMC", "ZJS", "XZHJ", "XZTZ", "XZZZ", "GJS", "JHGJS", "TZJHJ", "TZJHJRZ", "TZJZBJ", "TZJZBJRZ",
    //                        "TZJTGSH", "TZJTGSHRZ", "TZJJXLW", "TZJJXLWRZ", "TZJJXGZQT", "TZJJXGZQTRZ", "TZJGXYY",
    //                        "TZJGXYYRZ", "TZJSBYY", "TZJSBYYRZ", "TZJDMYYQT", "TZJDMYYQTRZ", "TZJQT", "TZJQTRZ", "DBFJS",
    //                        "SJYLYL", "SJNLYL", "SJYTJL", "SJNTJL", "SJYZSSL", "SJNZSSL"}},
    //            new GCBBINFO{Bbh="b03",ViewName="vw_b03",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18, IsMergable=false,
    //                headerFields=new string[] { "DWMC", "YYJHRJ", "YYJHDY", "YYJHNL", "YYSJRJ", "YYSJDY", "YYSJNL", "YYYWCL",
    //                           "YYNWCL", "YYYLDY", "YYYLNL", "TRQNJH", "TRQDY", "TRQNL", "TRQNWCL"}},
    //            new GCBBINFO{Bbh="b041",ViewName="vw_flt_b041",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] { "DWMC", "CYFS", "ZJS", "KJS", "PJDJRCYE", "RCYE", "YCYE", "NCYE", "PJDJRCY", "RCY", "YCY", "NCY", "ZHHS", "DYSCSJ", "DYRLSJ",
    //                            "DYSCSX", "NLSCSJ", "NLRLSJ", "NLSCSX", "DYHD", "DYDYEDH", "DYDYDH", "NLHD", "NLDYEDH", "NLDYDH"}},
    //            new GCBBINFO{Bbh="b042",ViewName="vw_flt_b042",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15, IsMergable=true,
    //                headerFields=new string[] {"DWMC", "BJ", "TJJS", "RCYE", "RCY", "ZHHS", "DJRCYE", "DJRCY", "DYMTJJS", "PJDYM", "PJBS", "PJCMD", "LLPL",
    //                            "SJPL", "PJBX", "JBZQTJJS", "JBZQ"}},
    //            new GCBBINFO{Bbh="b043",ViewName="vw_flt_b043",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15, IsMergable=true,
    //                headerFields=new string[] {"DWMC", "BJ", "DYMTJJS", "DYM500", "DYM1000", "DYM1500", "DYM2000", "DYMMORE",
    //                            "BS800", "BS1300", "BS1500", "BS1800", "BS2000", "BSMORE", "CMD300", "CMD500", "CMDMORE"}},
    //            new GCBBINFO{Bbh="b044",ViewName="vw_b044",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18, IsMergable=false,
    //                headerFields=new string[] {"DWMC", "CYJKJS", "CYJCSGTJS", "CYJZDJS", "CYJZDL", "CYJGK_ZC", "CYJGK_YDFELS", "CYJGK_GDFELS", "CYJGK_FFELS", "CYJGK_BJXLS", "CYJGK_YGLS",
    //                            "CYJGK_CYGDT", "CYJGK_QTYX", "CYJGK_GYBZ", "CYJGK_BTCGZT", "CYJGK_CTL",
    //                            "CYJGK_JLYZ", "CYJGK_QT", "CYJDBKJS", "CYJDBCSJS", "CYJDBCSL"}},
    //            new GCBBINFO{Bbh="b05",ViewName="vw_b05",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18, IsMergable=false,
    //                headerFields=new string[] {"DWMC", "DYCZZJS", "DYCZPJZDSD", "DYCZPJCZCD", "DYCZCGJS", "DYCZYXJS", "DYCZCZFY",
    //                        "DYCZDJCZFY", "NLCZZJS", "NLCZPJZDSD", "NLCZPJCZCD", "NLCZCGJS", "NLCZYXJS", "NLCZKJS", "NLCZKJL", "NLCZCZFY",
    //                        "NLCZCZDJCZFY", "NLCZDJRCYE", "NLCZDJRCY", "NLCZRCYE", "NLCZRCY", "NLCZZHHS",
    //                        "NLCZYCYE", "NLCZYCY", "NLCZCYE", "NLCZCY"}},
    //            new GCBBINFO{Bbh="b06",ViewName="vw_b06",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18,IsMergable=false,
    //                headerFields=new string[] { "DWMC", "YJSPJDYZJS", "YJSPJDYPJSPDCD", "YJSPJNLZJS", "YJSPJNLPJSPDCD", "YJSPJNLKJS", "YJSPJNLKJL", "YJSPJNLDJRCYE", "YJSPJNLDJRCY",
    //                            "YJSPJNLRCYE", "YJSPJNLRCY", "YJSPJNLZHHS", "YJSPJNLYCYE", "YJSPJNLYCY", "YJSPJNLNLYE", "YJSPJNLNLY", "QJSPJDYZJS", "QJSPJDYPJSPDCD", "QJSPJNLZJS",
    //                            "QJSPJNLPJSPDCD", "QJSPJNLKJS", "QJSPJNLKJL", "QJSPJNLDJRCQ", "QJSPJNLDJRCY", "QJSPJNLDJRCS", "QJSPJNLRCQ", "QJSPJNLRCY", "QJSPJNLRCS", "QJSPJNLSQB",
    //                            "QJSPJNLYQB", "QJSPJNLYCQ", "QJSPJNLYCY", "QJSPJNLYCS", "QJSPJNLNLQ", "QJSPJNLNLY"}},
    //            new GCBBINFO{Bbh="b08",ViewName="vw_flt_b08",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "XMMC", "SCSGJC", "SCPJZRYL", "SCYZRL", "SCYZQL", "SCYZQTL",
    //                            "SCNZRL", "SCNZQL", "SCNZQTL", "SCYWGDL", "SCNWGDL",
    //                            "SCYZRFY", "SCYDFDJ", "SCYDF", "SCYQTFYDJ", "SCYQTFY", "SCYYJFDJ", "SCYYJF",
    //                            "SCNZRFY", "SCNDFDJ", "SCNDF", "SCNQTFYDJ", "SCNQTFY", "SCNYJFDJ", "SCNYJF",
    //                            "SCNZRDH", "SCNZRBH"}},
    //            new GCBBINFO{Bbh="b09",ViewName="vw_b09",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18,IsMergable=false,
    //                headerFields=new string[] { "DWMC", "ZJS", "KJS", "KJL", "JYCQJ", "HXPYCQJS", "JXPYCQJS", "DJRCQ",
    //                            "DJRCY", "DJRCS", "RCQ", "RCY", "RCS", "SQB", "YQB", "YCQ", "YCY", "YCS", "NCQ", "NCY", "NCS",
    //                            "YSCSJ", "YRLSJ", "YSCSX", "NSCSJ", "NRLSJ", "NSCSX"}},
    //            new GCBBINFO{Bbh="b101",ViewName="vw_b101",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=4,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "ZJS", "KJS", "PJJKZSYL", "PJDJRZSP", "PJRZSP", "YZSL", "NZSL", "YZWSL", "NZWSL", "YZSYJL",
    //                            "YZDBSL", "YZQSLHJ", "NZSYJL", "NZDBSL", "ZCKYSZDBL", "ZCKNSZDBL", "JKYSZDBL", "JKNSZDBL"},
    //                header2Fields=new string[]{ "DWMC", "KJS16", "YZSL16", "NZSL16", "KJS25", "YZSL25", "NZSL25", "KJS32", "YZSL32", "NZSL32",
    //                            "KJS32MORE", "YZSL32MORE", "NZSL32MORE", "YHDL", "NHDL", "YZSDH", "NZSDH", "YZSBH", "NZSBH"}
    //            },
    //            new GCBBINFO{Bbh="b102",ViewName="vw_b102",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=4,FontSize=9,LineHeight=13,IsMergable=false,
    //                headerFields=new string[] { "DWMC", "ZJS", "KJS", "YPZSL", "YZSL", "NZSL", "FCZJS", "FCKJS", "FCYPZSL", "FCYZSL", "FCNZSL",
    //                            "FCGYZJS", "FCGYKJS", "FCGYYPZSL", "FCGYYZSL", "FCGYNZSL", "FCCYZJS", "FCCYKJS", "FCCYYPZSL", "FCCYYZSL", "FCCYNZSL", "LTZJS",
    //                            "LTKJS", "LTYPZSL"},
    //                header2Fields=new string[]{"DWMC", "LTYZSL", "LTNZSL", "LTGYZJS", "LTGYKJS", "LTGYYPZSL", "LTGYYZSL", "LTGYNZSL",
    //                            "LTCYZJS", "LTCYKJS", "LTCYYPZSL", "LTCYYZSL", "LTCYNZSL", "ZJZGL", "LXBZJGL", "ZSBZJGL", "SYJZJS", "SYJKJS",
    //                            "SYJDXJS", "SYJBYJS", "SYJDBFJS", "SYJGSNL", "SYJDYGS", "SYJNLGS"}},
    //            new GCBBINFO{Bbh="b103",ViewName="vw_b103",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "ZYZSZS", "ZYZSZZYBS", "DTZYBS", "ZZJRL", "YXTS", "PJBCKYL", "RZSNL",
    //                            "ZYZSJZJS", "ZYZSJKJS", "ZYZSJPJJKZSYL", "ZYZSJDJRZSP", "ZYZSJRZSP", "ZYZSJYZYZSL", "ZYZSJNZYZSL",
    //                            "ZYZSYHDL", "ZYZSNHDL", "ZYZSYDH", "ZYZSNDH", "ZYZSYBH", "ZYZSNBH"}},
    //            new GCBBINFO{Bbh="b104",ViewName="vw_b104",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18,IsMergable=false,
    //                headerFields=new string[] { "DWMC", "FGQFZZJS", "FGQFZKJS", "FGQFZGJS", "ZDCFZZJS", "ZDCFZKJS", "ZDCFZGJS",
    //                            "FZCD1", "FZCD2", "FZCD3", "FZCD3MORE", "KXPSQJS", "PXPSQJS", "QTPSQJS", "YSFGQJS", "KZFGQJS",
    //                            "QTFGQJS", "FGQFZPJYXQ", "KJFZJZSYL25", "KJFZJZSYL25MORE", "SCTZZJS", "SCTZFZZJS"}},
    //            new GCBBINFO{Bbh="b11",ViewName="vw_flt_b11",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=11,LineHeight=18,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "JB", "DYDXGZL", "NLDXGZL", "DYDXFY", "DYDJDXFY", "NLDXFY", "NLDJDXFY", "DYPJXJTS", "NLPJXJTS",
    //                            "DYCGHJ", "DYCGXJ", "DYCGBX", "DYCGCD", "DYCGPL", "DYCGJXLW", "DYCGQGZ", "DYCGFZGZ", "DYCGQT",
    //                            "NLCGHJ", "NLCGXJ", "NLCGBX", "NLCGCD", "NLCGPL", "NLCGJXLW", "NLCGQGZ", "NLCGFZGZ", "NLCGQT",
    //                            "DYYXJS", "DYYXL", "DYHFNL", "DYHFCL",
    //                            "NLYXJS","NLYXL","NLHFNL","NLHFCL","NLYZCL","NLNZCL","NLDJZCL","NLDYFY","NLPJYXTS"  }},
    //            new GCBBINFO{Bbh="b121",ViewName="vw_b121",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=3,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "YGZL", "YCSWHGZL", "YCSGZL", "YWHGZL", "YTCGZL", "YJYGZL", "YJYCSWHGZL", "YJYCSGZL", "YJYWHGZL",
    //                            "YJYTCGZL", "QJYGZL", "QJYCSWHGZL", "QJYCSGZL", "QJYWHGZL", "QJYTCGZL", "SJYGZL", "SJYCSWHGZL", "SJYCSGZL",
    //                            "SJYWHGZL", "SJYTCGZL", "YZYPC", "YCSZYPC", "YWHZYPC", "YYJZYPC", "YYJCSZYPC", "YYJWHZYPC", "YQJZYPC", "YQJCSZYPC",
    //                            "YQJWHZYPC", "YSJZYPC", "YSJCSZYPC", "YSJWHZYPC"},
    //                header2Fields=new string[]{ "DWMC", "NGZL", "NCSWHGZL", "NCSGZL", "NWHGZL", "NTCGZL", "YJNGZL", "YJNCSWHGZL",
    //                            "YJNCSGZL", "YJNWHGZL", "YJNTCGZL", "QJNGZL", "QJNCSWHGZL", "QJNCSGZL", "QJNWHGZL", "QJNTCGZL", "SJNGZL",
    //                            "SJNCSWHGZL", "SJNCSGZL", "SJNWHGZL", "SJNTCGZL", "NZYPC", "NCSZYPC", "NWHZYPC", "NYJZYPC", "NYJCSZYPC",
    //                            "NYJWHZYPC", "NQJZYPC", "NQJCSZYPC", "NQJWHZYPC", "NSJZYPC", "NSJCSZYPC", "NSJWHZYPC"}
    //            },
    //            new GCBBINFO{Bbh="b122",ViewName="vw_b122",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=3,FontSize=9,LineHeight=16.5,IsMergable=false,
    //                headerFields=new string[] { "DWMC", "YZYFY", "CSYZYFY", "WHYZYFY", "YJYZYFY", "YJCSYZYFY", "YJWHYZYFY",
    //                            "QJYZYFY", "QJCSYZYFY", "QJWHYZYFY", "SJYZYFY", "SJCSYZYFY", "SJWHYZYFY", "YZYFY_DC", "CSYZYFY_DC", "WHYZYFY_DC",
    //                            "YJYZYFY_DC", "YJCSYZYFY_DC", "YJWHYZYFY_DC", "QJYZYFY_DC", "QJCSYZYFY_DC", "QJWHYZYFY_DC",
    //                            "SJYZYFY_DC", "SJCSYZYFY_DC", "SJWHYZYFY_DC"},
    //                header2Fields=new string[]{ "DWMC", "NZYFY", "CSNZYFY", "WHNZYFY", "YJNZYFY", "YJCSNZYFY", "YJWHNZYFY",
    //                            "QJNZYFY", "QJCSNZYFY", "QJWHNZYFY", "SJNZYFY", "SJCSNZYFY", "SJWHNZYFY", "NZYFY_DC",
    //                            "CSNZYFY_DC", "WHNZYFY_DC", "YJNZYFY_DC", "YJCSNZYFY_DC", "YJWHNZYFY_DC", "QJNZYFY_DC",
    //                            "QJCSNZYFY_DC", "QJWHNZYFY_DC", "SJNZYFY_DC", "SJCSNZYFY_DC", "SJWHNZYFY_DC"}
    //            },
    //            new GCBBINFO{Bbh="b131",ViewName="vw_b131",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=3,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "YJYGZL", "YJYCSWHGZL", "YJYCSGZL", "YYJCS_DX", "YYJCS_BKGC", "YYJCS_YL", "YYJCS_SH", "YYJCS_JD", "YYJCS_XDB",
    //                            "YYJCS_XSLB", "YYJCS_QJ", "YYJCS_ZC", "YYJCS_BSJ", "YYJCS_BJS", "YYJCS_JXDS", "YYJCS_HXDS", "YYJCS_FS", "YYJCS_FCDL", "YYJCS_TTTP", "YYJCS_GC",
    //                            "YYJCS_QT", "YJYWHGZL", "YYJWH_JBXJ", "YYJWH_JBJC", "YYJWH_JBJD", "YYJWH_JBJF", "YYJWH_JBQT", "YYJWH_YBDLJQ", "YYJWH_XB", "YYJWH_CYRC", "YYJWH_FJ", "YYJWH_JKJC",
    //                            "YYJWH_YCJC", "YYJWH_QT", "YJYTCGZL", "YYJXT_XT", "YYJXT_CZ"},
    //                header2Fields=new string[]{"DWMC", "YJNGZL", "YJNCSWHGZL", "YJNCSGZL", "NYJCS_DX", "NYJCS_BKGC", "NYJCS_YL", "NYJCS_SH",
    //                            "NYJCS_JD", "NYJCS_XDB", "NYJCS_XSLB", "NYJCS_QJ", "NYJCS_ZC", "NYJCS_BSJ", "NYJCS_BJS", "NYJCS_JXDS", "NYJCS_HXDS", "NYJCS_FS", "NYJCS_FCDL", "NYJCS_TTTP",
    //                            "NYJCS_GC", "NYJCS_QT", "YJNWHGZL", "NYJWH_JBXJ", "NYJWH_JBJC", "NYJWH_JBJD", "NYJWH_JBJF", "NYJWH_JBQT", "NYJWH_YBDLJQ",
    //                            "NYJWH_XB", "NYJWH_CYRC", "NYJWH_FJ", "NYJWH_JKJC", "NYJWH_YCJC", "NYJWH_QT", "YJNTCGZL", "NYJXT_XT", "NYJXT_CZ"}
    //            },
    //            new GCBBINFO{Bbh="b132",ViewName="vw_b132",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=2,FontSize=9,LineHeight=15,IsMergable=false,
    //                 headerFields=new string[] {"DWMC", "QJYGZL", "QJYCSWHGZL", "QJYCSGZL", "YQJCS_DX", "YQJCS_BKGC", "YQJCS_YL", "YQJCS_SH",
    //                            "YQJCS_FS", "YQJCS_FCDL", "YQJCS_GC", "YQJCS_QT", "QJYWHGZL", "YQJWH_JG", "YQJWH_JP", "YQJWH_FJ", "YQJWH_JKJC", "YQJWH_QCJC",
    //                            "YQJWH_QT", "QJYTCGZL", "YQJXT_XT", "YQJXT_CZ"},
    //                 header2Fields=new string[]{"DWMC", "QJNGZL", "QJNCSWHGZL", "QJNCSGZL", "NQJCS_DX", "NQJCS_BKGC", "NQJCS_YL",
    //                            "NQJCS_SH", "NQJCS_FS", "NQJCS_FCDL", "NQJCS_GC", "NQJCS_QT", "QJNWHGZL", "NQJWH_JG", "NQJWH_JP", "NQJWH_FJ",
    //                            "NQJWH_JKJC", "NQJWH_QCJC", "NQJWH_QT", "QJNTCGZL", "NQJXT_XT", "NQJXT_CZ"}
    //            },
    //            new GCBBINFO{Bbh="b133",ViewName="vw_b133",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=2,FontSize=9,LineHeight=15,IsMergable=false,
    //                 headerFields=new string[] {"DWMC", "SJYGZL", "SJYCSWHGZL", "SJYCSGZL", "YSJCS_DX", "YSJCS_BKGC", "YSJCS_YL", "YSJCS_SH", "YSJCS_FS",
    //                            "YSJCS_TP", "YSJCS_FCDL", "YSJCS_FZ", "YSJCS_ZZ", "YSJCS_QT", "SJYWHGZL", "YSJWH_JG", "YSJWH_HF", "YSJWH_TP", "YSJWH_FJ",
    //                            "YSJWH_JKJC", "YSJWH_YCJC", "YSJWH_QT", "SJYTCGZL"},
    //                 header2Fields=new string[]{"DWMC", "SJNGZL", "SJNCSWHGZL", "SJNCSGZL", "NSJCS_DX", "NSJCS_BKGC", "NSJCS_YL", "NSJCS_SH", "NSJCS_FS",
    //                             "NSJCS_TP", "NSJCS_FCDL", "NSJCS_FZ", "NSJCS_ZZ", "NSJCS_QT", "SJNWHGZL", "NSJWH_JG", "NSJWH_HF", "NSJWH_TP", "NSJWH_FJ",
    //                             "NSJWH_JKJC", "NSJWH_YCJC", "NSJWH_QT", "SJNTCGZL"}
    //            },
    //            new GCBBINFO{Bbh="b14",ViewName="vw_flt_b14",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] { "DWMC", "CSXM", "DYSGJC", "DYCGJC", "DYYXJC", "DYCSFY", "DYZCYE", "DYZCY", "DYZCQ", "NLSGJC",
    //                            "NLCGJC", "NLCGL", "NLYXJC", "NLYXL", "NLCSFY", "NLDJCSFY", "NLDYCSFY", "NLDJZYL", "NLYZYE", "NLYZY",
    //                            "NLYZQ", "NLNZYE", "NLNZY", "NLNZQ", "NLPJYXQ"}},
    //            new GCBBINFO{Bbh="b141",ViewName="vw_flt_b141",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "CSXM", "DYSGJC_LJ", "DYCGJC_LJ", "DYYXJC_LJ", "DYCSFY_LJ", "DYZCYE_LJ", "DYZCY_LJ", "DYZCQ_LJ",
    //                            "NLSGJC_LJ", "NLCGJC_LJ", "NLCGL_LJ", "NLYXJC_LJ", "NLYXL_LJ", "NLCSFY_LJ", "NLDJCSFY_LJ", "NLDYCSFY_LJ", "NLDJZYL_LJ", "NLYZYE_LJ",
    //                            "NLYZY_LJ", "NLYZQ_LJ", "NLNZYE_LJ", "NLNZY_LJ", "NLNZQ_LJ", "NLPJYXQ_LJ"}},
    //            new GCBBINFO{Bbh="b142",ViewName="vw_flt_b142",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "CSXM", "DYSGJC_XJ", "DYCGJC_XJ", "DYYXJC_XJ", "DYCSFY_XJ", "DYZCYE_XJ", "DYZCY_XJ", "DYZCQ_XJ", "NLSGJC_XJ",
    //                            "NLCGJC_XJ", "NLCGL_XJ", "NLYXJC_XJ", "NLYXL_XJ", "NLCSFY_XJ", "NLDJCSFY_XJ", "NLDYCSFY_XJ", "NLDJZYL_XJ", "NLYZYE_XJ", "NLYZY_XJ", "NLYZQ_XJ",
    //                            "NLNZYE_XJ", "NLNZY_XJ", "NLNZQ_XJ", "NLPJYXQ_XJ"}},
    //            new GCBBINFO{Bbh="b15",ViewName="vw_flt_b15",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "CSXM", "DYSGJC", "DYCGJC", "DYYXJC", "DYZCQ", "DYZCY", "DYCSFY", "NLSGJC",
    //                            "NLCGJC", "NLCGL", "NLYXJC", "NLYXL", "NLYZQ", "NLYZY", "NLNZQ", "NLNZY", "NLDJZQL", "NLCSFY", "NLDJCSFY", "NLFQCSFY", "NLPJYXQ"}},
    //            new GCBBINFO{Bbh="b151",ViewName="vw_flt_b151",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "CSXM", "DYSGJC_LJ", "DYCGJC_LJ", "DYYXJC_LJ", "DYZCQ_LJ", "DYZCY_LJ", "DYCSFY_LJ", "NLSGJC_LJ", "NLCGJC_LJ", "NLCGL_LJ",
    //                            "NLYXJC_LJ", "NLYXL_LJ", "NLYZQ_LJ", "NLYZY_LJ", "NLNZQ_LJ", "NLNZY_LJ",
    //                            "NLDJZQL_LJ", "NLCSFY_LJ", "NLDJCSFY_LJ", "NLFQCSFY_LJ", "NLPJYXQ_LJ"}},
    //            new GCBBINFO{Bbh="b152",ViewName="vw_flt_b152",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "CSXM", "DYSGJC_XJ", "DYCGJC_XJ", "DYYXJC_XJ", "DYZCQ_XJ", "DYZCY_XJ", "DYCSFY_XJ", "NLSGJC_XJ",
    //                            "NLCGJC_XJ", "NLCGL_XJ", "NLYXJC_XJ", "NLYXL_XJ", "NLYZQ_XJ", "NLYZY_XJ", "NLNZQ_XJ", "NLNZY_XJ", "NLDJZQL_XJ", "NLCSFY_XJ", "NLDJCSFY_XJ",
    //                            "NLFQCSFY_XJ", "NLPJYXQ_XJ"}},
    //            new GCBBINFO{Bbh="b16",ViewName="vw_flt_b16",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "CSXM", "DYSGJC", "DYCGJC", "DYYXJC", "DYZZL", "DYCSFY", "NLSGJC", "NLCGJC", "NLCGL", "NLYXJC", "NLYXL", "NLYZZL",
    //                            "NLNZZL", "NLDJZZL", "NLCSFY", "NLDJCSFY", "NLPJYXQ", "DYJJS",
    //                            "DYJJXS", "DYJYZY", "DYJNZY", "DYJYJYE", "DYJNJYE", "DYJPJYXQ"}},
    //            new GCBBINFO{Bbh="b17",ViewName="vw_b17",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=4,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] { "DWMC", "YWHGZL", "WHYZYFY", "WHYZYFY_LW", "WHYZYFY_CL", "WHYZYFY_DC", "WHYZYFY_DC_LW", "WHYZYFY_DC_CL",
    //                        "YJYWHGZL", "YJWHYZYFY", "YJWHYZYFY_LW", "YJWHYZYFY_CL", "YJWHYZYFY_DC", "YJWHYZYFY_DC_LW", "YJWHYZYFY_DC_CL",
    //                         "QJYWHGZL", "QJWHYZYFY", "QJWHYZYFY_LW", "QJWHYZYFY_CL", "QJWHYZYFY_DC", "QJWHYZYFY_DC_LW", "QJWHYZYFY_DC_CL",
    //                        "SJYWHGZL", "SJWHYZYFY", "SJWHYZYFY_LW", "SJWHYZYFY_CL", "SJWHYZYFY_DC",
    //                        "SJWHYZYFY_DC_LW", "SJWHYZYFY_DC_CL"},
    //                header2Fields=new string[] {"DWMC", "NWHGZL", "WHNZYFY", "WHNZYFY_LW", "WHNZYFY_CL", "WHNZYFY_DC", "WHNZYFY_DC_LW", "WHNZYFY_DC_CL",
    //                        "YJNWHGZL", "YJWHNZYFY", "YJWHNZYFY_LW", "YJWHNZYFY_CL", "YJWHNZYFY_DC", "YJWHNZYFY_DC_LW", "YJWHNZYFY_DC_CL",
    //                        "QJNWHGZL", "QJWHNZYFY", "QJWHNZYFY_LW", "QJWHNZYFY_CL", "QJWHNZYFY_DC", "QJWHNZYFY_DC_LW", "QJWHNZYFY_DC_CL",
    //                        "SJNWHGZL", "SJWHNZYFY", "SJWHNZYFY_LW", "SJWHNZYFY_CL", "SJWHNZYFY_DC",
    //                        "SJWHNZYFY_DC_LW", "SJWHNZYFY_DC_CL"}
    //            },
    //            new GCBBINFO{Bbh="b18",ViewName="vw_b18",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=2,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "DYJBJS", "DYJBYGXJ", "DYJBYGGD", "DYJBYGGT", "DYJBYGGL", "DYJBCYGXJ",
    //                           "DYJBCYGGD", "DYJBCYGGT", "DYJBCYBXJ", "DYJBCYBBL", "DYJBCYBFEZD", "DYJBCYBFEZT", "DYJBCYBQT",
    //                            "DYJBJXGJXJ", "DYJBJXGJFTQ", "DYJBJXGJXYQ", "DYJBJXGJFZQ", "DYJBJXGJYGM", "DYJBJXGJFGQ", "DYJBJXGJQT",
    //                            "DYJBDBXJ", "DYJBDBDL", "DYJBDBDB", "DYJBDBQT", "DYJBSLQ"},
    //                header2Fields=new string[] {"DWMC", "NLJBJS", "NLJBYGXJ", "NLJBYGGD", "NLJBYGGT", "NLJBYGGL", "NLJBCYGXJ",
    //                            "NLJBCYGGD", "NLJBCYGGT", "NLJBCYBXJ", "NLJBCYBBL", "NLJBCYBFEZD", "NLJBCYBFEZT", "NLJBCYBQT",
    //                            "NLJBJXGJXJ", "NLJBJXGJFTQ", "NLJBJXGJXYQ", "NLJBJXGJFZQ", "NLJBJXGJYGM", "NLJBJXGJFGQ", "NLJBJXGJQT",
    //                            "NLJBDBXJ", "NLJBDBDL", "NLJBDBDB", "NLJBDBQT", "NLJBSLQ"}},
    //            new GCBBINFO{Bbh="b191",ViewName="vw_b191",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=4,FontSize=10,LineHeight=17.25,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "JYYJY", "JYNJY", "JYHS", "JYWD","JYYL", "WSDYGDY", "WSDYLY", "WSDYZJ", "WSNLGDY", "WSNLLY", "WSNLZJ", "WSHS",
    //                            "YYKCL", "WSPFDYWSL", "WSPFNLWSL", "WSPFHYL","YYTSDYCLL", "YYTSNLCLL", "YYTSJKHS", "YYTSCKHS", "YYTSFSHY",
    //                            "YYMBLDYMBL", "YYMBLDYMBLV", "YYMBLNLMBL", "YYMBLNLMBLV"},
    //                header2Fields=new string[] {"DWMC", "YYWDLYCLL", "YYWDLYCLLV", "YYWDLNCLL", "YYWDLNCLLV", "QQHSLDYQQHS",
    //                            "QQHSLDYQQHSL", "QQHSLNLQHS", "QQHSLNLQHSL", "HQWDJRL", "HQWSJRL",
    //                            "HQSCYGL", "HQXJ", "HQDYHQ", "HDDTSQ", "HDTSB",
    //                            "HDYSJ", "HDQT", "HDXJ", "HDWSBBX", "HDWSBHD",
    //                            "HDDYHJ", "HDNLHJ", "HDDYHD", "PRJDYYL", "PRJNLYL"}},
    //            new GCBBINFO{Bbh="b192",ViewName="vw_b192",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=4,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "DYSL", "DYCLYSJNL", "DYCLLZYE", "DYCLLZY", "DYHYJ", "DYHD", "DYHRYDL",
    //                            "DYDWYYHYJ", "DYDWYYHD", "DYDWYYHRYDL", "DYCLFYHJ", "DYCLFYYJ", "DYCLFYHD", "DYCLFYHRYDL",
    //                            "DYDWYYCLFYPJ", "DYDWYYCLFYYJ", "DYDWYYCLFYHD", "DYDWYYCLFYHRYDL"},
    //                header2Fields=new string[] {"DWMC", "NLSL", "NLCLYSJNL", "NLCLLZYE", "NLCLLZY", "NLHYJ", "NLHD", "NLHRYDL",
    //                            "NLDWYYHYJ", "NLDWYYHD", "NLDWYYHRYDL", "NLCLFYHJ", "NLCLFYYJ", "NLCLFYHD", "NLCLFYHRYDL",
    //                            "NLDWYYCLFYPJ", "NLDWYYCLFYYJ", "NLDWYYCLFYHD", "NLDWYYCLFYHRYDL"}},
    //            new GCBBINFO{Bbh="b193",ViewName="vw_b193",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=4,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "JZZ_DYSL", "JZZ_DYCLYSJNL", "JZZ_DYCLLZYE", "JZZ_DYCLLZY", "JZZ_DYHYJ",
    //                            "JZZ_DYHD", "JZZ_DYHRYDL", "JZZ_DYDWYYHYJ", "JZZ_DYDWYYHD", "JZZ_DYDWYYHRYDL", "JZZ_DYCLFYHJ",
    //                            "JZZ_DYCLFYYJ", "JZZ_DYCLFYHD", "JZZ_DYCLFYHRYDL", "JZZ_DYDWYYCLFYPJ", "JZZ_DYDWYYCLFYYJ",
    //                            "JZZ_DYDWYYCLFYHD", "JZZ_DYDWYYCLFYHRYDL"},
    //                header2Fields=new string[] {"DWMC", "JZZ_NLSL", "JZZ_NLCLYSJNL", "JZZ_NLCLLZYE", "JZZ_NLCLLZY", "JZZ_NLHYJ",
    //                            "JZZ_NLHD", "JZZ_NLHRYDL", "JZZ_NLDWYYHYJ",
    //                            "JZZ_NLDWYYHD", "JZZ_NLDWYYHRYDL", "JZZ_NLCLFYHJ", "JZZ_NLCLFYYJ", "JZZ_NLCLFYHD",
    //                            "JZZ_NLCLFYHRYDL", "JZZ_NLDWYYCLFYPJ", "JZZ_NLDWYYCLFYYJ", "JZZ_NLDWYYCLFYHD", "JZZ_NLDWYYCLFYHRYDL"}},
    //            new GCBBINFO{Bbh="b201",ViewName="vw_b201",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] { "DWMC", "SJNL", "YCLWSXJ", "YCLWSYYTS", "YCLWSXJQT", "NCLWSXJ", "NCLWSYYTS", "NCLWSXJQT",
    //                            "YYJHJ", "YYJYHJ", "YYJPHTZJ", "YYJXNJ", "YYJSJJ", "YYJWDJ", "NYJHJ",
    //                            "NYJYHJ", "NYJPHTZJ", "NYJXNJ", "NYJSJJ", "NYJWDJ"}},
    //            new GCBBINFO{Bbh="b202",ViewName="vw_b202",StartLineNumber=6,IsTwoHead=true,SecondHeadLineNumber=3,FontSize=9,LineHeight=15,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "DYWSZSL", "DYWSCLSJNL", "DYCLLHJ", "DYCLLHZL", "DYCLLHZLV", "DYCLLHGL", "DYCLLWPL",
    //                            "DYCLLQTL", "DYHYJ", "DYHD", "DYDWWSHYJ", "DYDWWSHD", "DYCLFYHJ", "DYCLFYHYJ", "DYCLFYHD", "DYDWWSCLFYHJ", "DYDWWSCLFYHYJ", "DYDWWSCLFYHD"},
    //                header2Fields=new string[] {"DWMC", "NLWSZSL", "NLWSCLSJNL", "NLCLLHJ", "NLCLLHZL", "NLCLLHZLV", "NLCLLHGL", "NLCLLWPL", "NLCLLQTL", "NLHYJ", "NLHD",
    //                            "NLDWWSHYJ", "NLDWWSHD", "NLCLFYHJ", "NLCLFYHYJ", "NLCLFYHD", "NLDWWSCLFYHJ", "NLDWWSCLFYHYJ", "NLDWWSCLFYHD"}},
    //            new GCBBINFO{Bbh="b211",ViewName="vw_flt_b211",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "JB", "SGJMQHJ", "SGJMQDBJS", "SGJMQTCXJ", "SGJMQTCDBF", "TSJDYXJ", "TSJNLXJ", "TSJMQXJ",
    //                            "TSJDYBX", "TSJNLBX", "TSJMQBX", "TSJDYCD", "TSJNLCD", "TSJMQCD", "TSJDYPL", "TSJNLPL", "TSJMQPL", "JXLWDY", "JXLWNL", "JXLWMQ", "KGZDY",
    //                            "KGZNL", "KGZMQ", "FZSGDY", "FZSGNL", "FZSGMQ", "QTDY", "QTNL", "QTMQ"}},
    //            new GCBBINFO{Bbh="b212",ViewName="vw_flt_b212",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=15,IsMergable=true,
    //                headerFields=new string[] {"DWMC", "JB", "TSJKHJ", "TSJKTG4", "TSJKTG4_5", "TSJKTG5", "TSJKTG7",
    //                         "TSJKTGQT", "DNTSJKHJ", "DNTSJKTG4", "DNTSJKTG4_5", "DNTSJKTG5", "DNTSJKTG7", "DNTSJKTGQT"}},
    //            new GCBBINFO{Bbh="b221",ViewName="vw_b221",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "WCGZLDYJS", "WCGZLDYZRJC", "WCGZLNLJS", "WCGZLNLZRJC", "SBWHLDYRLTS", "SBWHLDYWHTS",
    //                            "SBWHLDY", "SBWHLNLRLTS", "SBWHLNLWHTS", "SBWHLNL", "SCSXDYRLSJ", "SCSXDYSCSJ", "SCSXDY", "SCSXNLRLSC", "SCSXNLSCSJ",
    //                            "SCSXNL", "DYSGJS", "SGFGLDYFGSJ", "SGFGLDY", "NLSGJS", "SGFGLNLFGSJ", "SGFGLNL",
    //                            "ZLQZLDYYLQXS", "ZLQZLDYSJLQXS", "ZLQZLDY", "ZLQZLNLYLQXS", "ZLQZLNLSJLQXS", "ZLQZLNL"}},
    //            new GCBBINFO{Bbh="b222",ViewName="vw_b222",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "DYSGQYJS", "SGQYLDYQYJS", "SGQYLDY", "NLSGQYJS", "SGQYLNLQYJS", "SGQYLNL",
    //                            "DYSGHGJS", "SGHGLDYHGJS", "SGHGLDY", "NLSGHGJS", "SGHGLNLHGJS", "SGHGLNL",
    //                            "DYSGYCHGJS", "SGYCHGLDYYCHGJS", "SGYCHGLDY", "NLSGYCHGJS", "SGYCHGLNLYCHGJS", "SGYCHGLNL",
    //                            "SGYCCGLDYGXS", "SGYCCGLDYGXYCCGS", "SGYCCGLDY", "SGYCCGLNLGXS", "SGYCCGLNLGXYCCGS", "SGYCCGLNL"}},
    //            new GCBBINFO{Bbh="b231",ViewName="vw_b231",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "CYJDMZYL", "CYJ8", "CYJ10", "CYJ11", "CYJ12", "CYJ14", "CYJQT", "CYGJXZYL", "CYGXGHJ", "CYGXGXJ", "CYGXGLJ", "CYGXGGXL",
    //                            "CYGXFGXFL", "CYGXFGZYL", "CYGXFGZYLV", "CYGBFGBFL", "CYGBFGBFLV", "CYBJXZYL",
    //                            "CYBXBHJ", "CYBXBXJ", "CYBXBLJ", "CYBXBGXL"}},
    //            new GCBBINFO{Bbh="b232",ViewName="vw_b232",StartLineNumber=6,IsTwoHead=false,SecondHeadLineNumber=5,FontSize=9,LineHeight=18,IsMergable=false,
    //                headerFields=new string[] {"DWMC", "YGJXZYLHJ", "YGJXZYLYJ", "YGJXZYLQJ", "YGJXZYLSJ", "YGNLXGZYLHJ", "YGNLXGZYLYJ", "YGNLXGZYLQJ", "YGNLXGZYLSJ",
    //                            "YGNLXJXGZYLHJ", "YGNLXJXGZYLYJ", "YGNLXJXGZYLQJ", "YGNLXJXGZYLSJ", "YGNLLJXGZYLHJ", "YGNLLJXGZYLYJ", "YGNLLJXGZYLQJ", "YGNLLJXGZYLSJ",
    //                            "YGGXLHJ", "YGGXLYJ", "YGGXLQJ", "YGGXLSJ", "NLXFGSL", "NLXFGZYL", "NLXFGZYLV", "NLBFGSL", "NLBFGBFL"}}
    //        };
    //        #endregion
    //        string year = ny.Substring(0, 4), month = ny.Substring(4, 2);
    //        //1、封面
    //        string yearHZ = GetHZ(year);
    //        string monthHZ = GetHZ(month);
    //        string yearHZbcrq = GetHZ(DateTime.Now.Year);
    //        string monthHZbcrq = GetHZ(DateTime.Now.Month.ToString());
    //        string dayHZbcrq = GetHZ(DateTime.Now.Day.ToString());
    //        Workbook wb = new Workbook(mbpath);
    //        Worksheet ws = wb.Worksheets["封面"];
    //        ws.Cells[0, 16].Value = yearHZ;
    //        ws.Cells[1, 16].Value = monthHZ;
    //        ws.Cells[3, 16].Value = yearHZbcrq;
    //        ws.Cells[4, 16].Value = monthHZbcrq;
    //        ws.Cells[5, 16].Value = dayHZbcrq;
    //        OracleParameter[] para = new OracleParameter[1]{
    //                    new OracleParameter("dwdm",OracleDbType.Varchar2,dwdm,ParameterDirection.Input)
    //                };
    //        DataTable data;
    //        string sql;
    //        //请求单位名称，填报人名称
    //        if (dwdm=="1")
    //        {
    //            ws.Cells[3, 6].Value = "工程技术管理部";
    //        }
    //        else
    //        {
    //            sql="select dwmc from sys_org where dwdm=:dwdm and rownum=1";
    //            ws.Cells[3, 6].Value = DB.ZYCYGC.QueryOneValue(sql, para);
    //        }
    //        ws.Cells[4, 6].Value = username;
    //        //请求审核人，审定人
    //        para = new OracleParameter[2]{
    //                    new OracleParameter("ny",OracleDbType.Varchar2,ny,ParameterDirection.Input),
    //                    new OracleParameter("dwdm",OracleDbType.Varchar2,dwdm,ParameterDirection.Input)
    //                };
            
    //        sql = "select shr,sdr from sys_shxx where ny=:ny and dwdm=:dwdm ";
    //        data = DB.ZYCYGC.Query(sql, para);
    //        if (data.Rows.Count > 0)
    //        {
    //            DataRow dr = data.Rows[0];
    //            ws.Cells[5, 6].Value = dr["SHR"].ToString();
    //            ws.Cells[6, 6].Value = dr["SDR"].ToString();
    //        }
    //        //如果是厂用户，则判断厂的油田、联污的个数。
    //        /*SELECT SUM(CASE WHEN tjjb = 2 THEN 1 END) yt, SUM(CASE WHEN tjjb = 4 THEN 1 END) lhz, SUM(CASE WHEN tjjb = 5 THEN 1 END) wsz
    //          FROM sys_org WHERE cdm = v_cdm*/
    //        int yt_cnt = 0, lhz_cnt = 0, wsz_cnt = 0;
    //        if (dwdm != "1")
    //        {
    //            para = new OracleParameter[1]{
    //                    new OracleParameter("dwdm",OracleDbType.Varchar2,dwdm,ParameterDirection.Input)
    //                };
    //            data = DB.ZYCYGC.Query(@"SELECT SUM(CASE WHEN tjjb = 2 THEN 1 END) yt, SUM(CASE WHEN tjjb = 4 THEN 1 END) lhz, SUM(CASE WHEN tjjb = 5 THEN 1 END) wsz
    //                                FROM sys_org WHERE cdm =:dwdm", para);
    //            if (data.Rows.Count > 0)
    //            {
    //                DataRow dr = data.Rows[0];
    //                if (dr["YT"] != DBNull.Value)
    //                    yt_cnt = Convert.ToInt32(dr["YT"]);
    //                if (dr["LHZ"] != DBNull.Value)
    //                    lhz_cnt = Convert.ToInt32(dr["LHZ"]);
    //                if (dr["WSZ"] != DBNull.Value)
    //                    wsz_cnt = Convert.ToInt32(dr["WSZ"]);
    //            }
    //        }
    //        //2、循环每一张表。
    //        int bbIndex = 2; //记录当前处理的sheet的编号
    //        if (bbhs != "*")
    //        {
    //            wb.Worksheets[0].VisibilityType = VisibilityType.Hidden;
    //            wb.Worksheets[1].VisibilityType = VisibilityType.Hidden;
    //        }
    //        var arr_bbhs = bbhs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
    //        for (int i = 0; i < vw_list.Length; i++)
    //        {
    //            var info = vw_list[i];
    //            ws = wb.Worksheets[bbIndex];
    //            //如果当前表不导出，则直接删除该表，且不增加索引
    //            if (bbhs != "*" && !arr_bbhs.Contains(info.Bbh))
    //            {
    //                wb.Worksheets.RemoveAt(bbIndex);
    //                continue;
    //            }
    //            #region 1、请求数据。如果没有数据，则删除该表，不增加索引。
    //            if (dwdm == "1")
    //            {
    //                //导出不带勘探、探区井号的情况。普通表导v4,v5,v6 和采油厂,   19-1,20-1导 v4,v5,v6 和联污站
    //                if (exportflag == "1")
    //                {
    //                    if (info.ViewName == "vw_b191" || info.ViewName == "vw_b201")
    //                    {
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb>=4 and dwdm not in('1','2','3','10252083','31301847','10252083w') order by dwpx,flpx";
    //                    }
    //                    else
    //                    {
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb>=3 and dwdm not in('1','2','3','10252083','31301847') order by dwpx,flpx";
    //                    }
    //                }
    //                //导出带勘探、探区井号的情况
    //                else if (exportflag == "2")
    //                {
    //                    if (info.ViewName == "vw_b191" || info.ViewName == "vw_b201")
    //                    {
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb>=4 and dwdm not like 'v%' order by dwpx,flpx";
    //                    }
    //                    else
    //                    {
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb>=3 and dwdm not like 'v%' order by dwpx,flpx";
    //                    }
    //                }
    //                //不含井数，导出三级数据 中原+厂+油田 
    //                else if (exportflag == "3")
    //                {
    //                    sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb>=2 and dwdm not in('1','2','3','10252083','31301847','10252083w') order by dwpx,flpx";
    //                }
    //                //含井数，三级数据 中原+厂+油田 
    //                else if (exportflag == "4")
    //                {
    //                    sql = (@"select * from {0} where ny=:ny and  shbz='1' and tjjb>=2 and dwdm not like 'v%' order by dwpx,flpx");
    //                }
    //                //不含井数，中原+油田   中原+联污 
    //                else if (exportflag == "5")
    //                {
    //                    sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb>=2 and (tjjb<>3 or dwdm in ('v10252083','v31301847')) and dwdm not in('1','2','3','10252083','31301847','10252083w') order by dwpx,flpx";
    //                }
    //                //含井数，中原+油田  中原+联污 
    //                else if (exportflag == "6")
    //                {
    //                    sql = (@"select * from {0} where ny=:ny and  shbz='1' and tjjb>=2 and (tjjb<>3 or dwdm in ('10252083','31301847')) and dwdm not like 'v%' order by dwpx,flpx");
    //                }
    //                para = new OracleParameter[1]{
    //                    new OracleParameter("ny",OracleDbType.Varchar2,ny,ParameterDirection.Input)
    //                };
    //            }
    //            //现在是厂用户导出。不包含虚构数据行。
    //            else
    //            {
    //                if (info.ViewName == "vw_b191")
    //                {
    //                    if (lhz_cnt == 1)
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb=3 and dwdm not like 'v%'
    //                                                        and dwdm in(select dwdm from sys_org where cdm=:cdm) order by dwpx,flpx";
    //                    else
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb>=3 and dwdm not like 'v%'
    //                                                        and dwdm in(select dwdm from sys_org where cdm=:cdm) order by dwpx,flpx";
    //                }
    //                else if (info.ViewName == "vw_b201")
    //                {
    //                    if (wsz_cnt == 1)
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb=3 and dwdm not like 'v%'
    //                                                        and dwdm in(select dwdm from sys_org where cdm=:cdm) order by dwpx,flpx";
    //                    else
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb>=3 and dwdm not like 'v%'
    //                                                        and dwdm in(select dwdm from sys_org where cdm=:cdm) order by dwpx,flpx";
    //                }
    //                else
    //                {
    //                    if (yt_cnt == 1)
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb=3 and dwdm not like 'v%'
    //                                                        and dwdm in(select dwdm from sys_org where cdm=:cdm) order by dwpx,flpx";
    //                    else
    //                        sql = @"select * from {0} where ny=:ny and  shbz='1' and tjjb>=2 and dwdm not like 'v%'
    //                                                        and dwdm in(select dwdm from sys_org where cdm=:cdm) order by dwpx,flpx";
    //                }

    //                para = new OracleParameter[2]{
    //                    new OracleParameter("ny",OracleDbType.Varchar2,ny,ParameterDirection.Input),
    //                    new OracleParameter("dwdm",OracleDbType.Varchar2,dwdm,ParameterDirection.Input),
    //                };
    //            }
    //            data = DB.ZYCYGC.Query(string.Format(sql, info.ViewName), para);
    //            if (data.Rows.Count == 0)
    //            {
    //                wb.Worksheets.RemoveAt(bbIndex);
    //                continue;
    //            }
    //            #endregion
    //            #region 2、创建数据值的样式及行高。
    //            var bordertype = CellBorderType.Thin;
    //            Style style = new Style();
    //            style.Font.Name = "宋体";
    //            style.Font.Size = info.FontSize;
    //            style.Borders[BorderType.BottomBorder].LineStyle = bordertype;
    //            style.Borders[BorderType.TopBorder].LineStyle = bordertype;
    //            style.Borders[BorderType.LeftBorder].LineStyle = bordertype;
    //            style.Borders[BorderType.RightBorder].LineStyle = bordertype;
    //            style.Font.IsBold = true;
    //            style.ShrinkToFit = true;
    //            style.HorizontalAlignment = TextAlignmentType.Right;
    //            style.VerticalAlignment = TextAlignmentType.Center;

    //            Style styleDWMC = new Style();
    //            styleDWMC.Copy(style);
    //            styleDWMC.HorizontalAlignment = TextAlignmentType.Center;

    //            Style style1 = new Style();
    //            style1.Copy(style);
    //            style1.Custom = "0.0";
    //            Style style2 = new Style();
    //            style2.Copy(style);
    //            style2.Custom = "0.00";
    //            Style style3 = new Style();
    //            style3.Copy(style);
    //            style3.Custom = "0.000";
    //            Style style4 = new Style();
    //            style4.Copy(style);
    //            style4.Custom = "0.0000";
    //            #endregion
    //            #region 3、循环插入数据
    //            int curPos1 = info.StartLineNumber, curPos2 = 0;
    //            if (info.IsTwoHead) curPos2 = info.StartLineNumber + info.SecondHeadLineNumber;
    //            foreach (DataRow row in data.Rows)
    //            {
    //                //上表头
    //                ws.Cells.InsertRow(curPos1);
    //                var range = ws.Cells.CreateRange(curPos1, 0, 1, 100);
    //                range.RowHeight = info.LineHeight;
    //                info.headerFields.ForEach<string>((field, idx) =>
    //                {
    //                    OutValue(style, styleDWMC, style1, style2, style3, style4, row, range, field, idx);
    //                });
    //                curPos1++;
    //                if (info.IsTwoHead)
    //                {
    //                    curPos2++;
    //                    //下表头
    //                    ws.Cells.InsertRow(curPos2);
    //                    range = ws.Cells.CreateRange(curPos2, 0, 1, 100);
    //                    range.RowHeight = info.LineHeight;
    //                    info.header2Fields.ForEach<string>((field, idx) =>
    //                    {
    //                        OutValue(style, styleDWMC, style1, style2, style3, style4, row, range, field, idx);
    //                    });
    //                    curPos2++;
    //                }
    //            }
    //            #endregion
    //            #region 4、单位列：合并单元格, 这些全是单表头,范围是第一列：[info.StartLineNumber,curPos1-1]
    //            if (info.IsMergable)
    //            {
    //                var oldDwmc = ws.Cells[info.StartLineNumber, 0].Value; //第一个值
    //                var mStart = info.StartLineNumber;  //从该行开始merge
    //                for (int j = info.StartLineNumber + 1; j <= curPos1; j++)
    //                {
    //                    //找到一个不同与前面的值 ，那么从mStart到j-1应该合并
    //                    if (ws.Cells[j, 0].Value != oldDwmc)
    //                    {
    //                        var range = ws.Cells.CreateRange(mStart, 0, j - mStart, 1);
    //                        range.Merge();
    //                        oldDwmc = ws.Cells[j, 0].Value;
    //                        mStart = j;
    //                    }
    //                }
    //            }
    //            #endregion
    //            //移动到下一页
    //            bbIndex++;
    //        }
    //        //3、输出到HttpResponseMessage
    //        var stream = new MemoryStream();
    //        wb.Save(stream, SaveFormat.Excel97To2003);

    //        HttpResponseMessage result = new HttpResponseMessage();
    //        ContentDispositionHeaderValue disposition = new ContentDispositionHeaderValue("attachment");
    //        disposition.FileName = filename;
    //        disposition.Name = filename.Replace(".xls", "");

    //        result.Content = new ByteArrayContent(stream.ToArray());
    //        result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/vnd.ms-excel");
    //        result.Content.Headers.ContentDisposition = disposition;
    //        return result;
    //    }

    //    private static void OutValue(Style style, Style styleDWMC, Style style1, Style style2, Style style3, Style style4, DataRow row, Range range, string field, int idx)
    //    {
    //        double value; //如果是值，保存其数据，然后存到excel中去。
    //        string s_value;
    //        int pointPos;
    //        if (field == "DWMC")
    //        {
    //            range[0, idx].SetStyle(styleDWMC);
    //            range[0, idx].Value = row[field];
    //        }
    //        else
    //        {
    //            s_value = row[field].ToString();
    //            if (double.TryParse(s_value, out value))
    //            {
    //                pointPos = s_value.LastIndexOf('.');
    //                if (pointPos == -1)
    //                {
    //                    range[0, idx].SetStyle(style);
    //                }
    //                else
    //                {
    //                    int jd = s_value.Length - (pointPos + 1);
    //                    if (jd == 1)
    //                        range[0, idx].SetStyle(style1);
    //                    else if (jd == 2)
    //                        range[0, idx].SetStyle(style2);
    //                    else if (jd == 3)
    //                        range[0, idx].SetStyle(style3);
    //                    else if (jd == 4)
    //                        range[0, idx].SetStyle(style4);
    //                }
    //                //不等于0输出，等于0就不显示了
    //                if (value != 0)
    //                {
    //                    range[0, idx].Value = value;
    //                }
    //            }
    //            else
    //            {
    //                //不是值，可能是采油方式或井别等 列
    //                range[0, idx].SetStyle(style);
    //                range[0, idx].Value = row[field];
    //            }

    //        }
    //    }
    //}

    public class GCBBINFO
    {
        /// <summary>
        /// 视图名字
        /// </summary>
        public string Bbh { get; set; }
        /// <summary>
        /// 视图名字
        /// </summary>
        public string ViewName { get; set; }
        /// <summary>
        /// 数据起始的行
        /// </summary>
        public int StartLineNumber { get; set; }
        /// <summary>
        /// 是否双表头
        /// </summary>
        public bool IsTwoHead { get; set; }
        public string[] headerFields { get; set; }
        public string[] header2Fields { get; set; }
        /// <summary>
        /// 第二表头的行高
        /// </summary>
        public int SecondHeadLineNumber { get; set; }
        /// <summary>
        /// 字体大小
        /// </summary>
        public int FontSize { get; set; }
        /// <summary>
        /// 行高
        /// </summary>
        public double LineHeight { get; set; }
        /// <summary>
        /// 是不是需要把单位列合并单元格
        /// </summary>
        public bool IsMergable { get; set; }
    }
}